<?php
namespace adminmatrix\admin\lists;
use think\App;
use think\Model;
use think\Request;

abstract class BaseListsData implements ListsInterface
{
    use ListsPagerTrait;
    use ListsSearchTrait;
    public Request $request;
    public $query;
    public int $pageNo;             # 初始化页码
    public int $pageSize;           # 初始化每页数量
    public int $pageType  = 0;      # 默认类型：0-一般分页；1-不分页，获取最大所有数据
    public int $pageSizeMax = 25000;# 当为0时候 默认最大页
    public int $limitOffset;            # 页码偏移
    public int $limitLength;            # 条数

    # 是否开启自动分页
    public bool $autoLimit = true;

    protected array $withSearch;          # 搜索数据
    protected array $params;              # 请求数据
    public function __construct(public App $app )
    {
        $this->request = $this->app->request;
        $this->initialize();

        $this->initPage();

        $this->initSearch();

    }

    protected function initialize()
    {
        // 子类可以重写此方法进行初始化
    }


}